import axios from 'axios';
import { getToken } from '@/utils/auth'
let instance  = axios.create({
    baseURL:"http://1.92.88.157:8080/",
    timeout:5000
})

instance.interceptors.request.use(
    config => {
      // do something before request is sent
      console.log("??:",getToken());
      config.headers['Authorization'] = "Bearer "+ getToken()
      // if (store.getters.token) {
      //   // let each request carry token
      //   // ['X-Token'] is a custom headers key
      //   // please modify it according to the actual situation
      //   config.headers['Authorization'] = "Bearer "+ getToken()
      // }
      return config
    },
    error => {
      // do something with request error
      console.log(error) // for debug
      return Promise.reject(error)
    }
  )


export default instance;